<?php
$this->breadcrumbs=array(
	'Issues'=>array('index'),
	'Manage',
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('issue-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Issues</h1>
<?php 
	$this->widget('zii.widgets.CMenu',array(
	'items'=>array(	
  	array('label'=>'Assign All Issues', 'url'=>array('assign')),
  	array('label'=>'Assign Edit All Issues', 'url'=>array('assigneditor')),
  	array('label'=>'Assign Resolve All Issue', 'url'=>array('assignresolve')),
  	array('label'=>'Resolve Question', 'url'=>array('resolve')),
  	array('label'=>'Edit Question/Answer', 'url'=>array('edit')),
	)
	));
?>


<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'issue-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		'ID',
		array(
			'name'=>'Người dùng',
			'value'=>'User::model()->getFullname($data->userID)',
		),
		array(
			'name'=>'Trạng thái',
			'value'=>'Status::model()->getStatus($data->status)',
		),
		/*array(
			'name'=>'Trạng thái',
			'value'=>'Status::model()->getStatus($data->status)',
		),*/		
		'attempt_time',
		array(
			'name'=>'Lớp',
			'value'=>'Grade::model()->getName($data->gradeID)',
		),
		'emergency',
		'estimate_idle_time',
		'notify_date',
		/*
		'level_complex',
		'content',
		'status',
		'resolver',
		'createddate',
		'modifieddate',
		'deleted',
		*/
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view}{delete}{assign}',
			'buttons'=>array(
				'assign'=>array(
					'label'=>'Phân bổ',
					'url'=>'"'.Yii::app()->baseUrl.'/admin/issue/assign/id/$data->ID"',
					'imageUrl'=>Yii::app()->baseUrl.'/images/assign.png'
				),
			),
		),
	),
)); ?>
